﻿using System;
using Telerik.Windows.Controls.Scheduler;
using Telerik.Windows.Controls;

namespace MedLink2011.Views.Patients.Controls.FirstLook
{
    public class SessionAppointment : Appointment
	{
		public override IAppointment Copy()
		{
			IAppointment appointment = new SessionAppointment();
			appointment.CopyFrom(this);
			return appointment;


		}

		public override void CopyFrom(IAppointment other)
		{
			SessionAppointment appointment = other as SessionAppointment;
			if (appointment != null)
			{
				base.CopyFrom(other);
			}

		}
        public string SessionRoom
        {
            get 
            {
                IResource resource = this.Resources.GetResourceByType("Room");
                if (resource!=null)
                {
                    return this.Resources.GetResourceByType("Room").ResourceName;
                }

                return null;
            }
            set
            {
                 this.Resources.Add(new Resource(value, "Room"));
                 OnPropertyChanged("SessionRoom");
            }
        }

        public string Speaker
        {
            get
            {
                IResource resource = this.Resources.GetResourceByType("Speaker");
                if (resource != null)
                {
                    return this.Resources.GetResourceByType("Speaker").ResourceName;
                }
                return null;
            }
            set
            {
                this.Resources.Add(new Resource(value, "Speaker"));
                OnPropertyChanged("Speaker");
            }
        }

        public int Level
        {
            get
            {
                IResource resource = this.Resources.GetResourceByType("Level");
                if (resource != null)
                {
                    return Int32.Parse(this.Resources.GetResourceByType("Level").ResourceName);
                }
                return 0;
            }
            set
            {
                 this.Resources.Add(new Resource(value.ToString(), "Level"));
                 OnPropertyChanged("Level");
            }
        }

    }
}
